package org.judo.components.uicontrol;

import java.util.StringTokenizer;

public class ComplexUIBase
{
	protected String formatDisplayName(String name)
	{
		String newName = "";
		
		StringTokenizer parts = new StringTokenizer(name,"_");
		
		while (parts.hasMoreElements())
		{
			String part = parts.nextToken();
			part = part.toLowerCase();
			part = (""+part.charAt(0)).toUpperCase()+part.substring(1);
			
			String newPart = "";
			char chs[] = part.toCharArray();
			
			for (char ch: chs)
			{
				if (Character.isUpperCase(ch))
					newPart += " "+ch;
				else
					newPart += ch;
			}
			
			newName+=" "+newPart;
		}
		
		return newName;
	}
}
